package com.sky.config;

import com.sky.properties.AliOssProperties;
import com.sky.utils.AliOssUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，创建alioss配置对象
 */
@Configuration

public class AliOssConfiguration {
    //aliossproperties配置对象（自定义的类）读取了yml文件中的配置后存储在属性中，直接读取就行
    @Bean
    public AliOssUtil getAliOssUtil(AliOssProperties aliOssProperties) {
        return new AliOssUtil(aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName());
    }
}
